﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraReports.UI;
using System.Data.SqlClient;

using DrugsShopManagement.DBCLASS;

namespace DrugsShopManagement
{
    public partial class FrmDrugsStoreManage : DevExpress.XtraEditors.XtraForm
    {
        public FrmDrugsStoreManage()
        {
            InitializeComponent();
        }
        Operator op = new Operator();

        

        private void button1_Click(object sender, EventArgs e)
        {
           try
           {
                if (radioButton2.Checked == true)
                {
                    try
                    {
                        if (textBoxYPID.Text != "")
                        {
                            if (textBoxPYM.Text != "")
                            {
                                if (textBoxGYS.Text != "")
                                {
                                    DataTable dt1 = new DataTable();
                                    string sql_1 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where drugsId like '%" + textBoxYPID.Text + "%' and  drugsPY like '%" + textBoxPYM.Text + "%' and providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                    dt1 = op.getDataTable(sql_1, "drugsStore ");
                                    dataGridView1.DataSource = dt1;
                                }
                                DataTable dt2 = new DataTable();
                                string sql_2 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where drugsId like '%" + textBoxYPID.Text + "%' and  drugsPY like '%" + textBoxPYM.Text + "%' order by Id";
                                dt2 = op.getDataTable(sql_2, "drugsStore ");
                                dataGridView1.DataSource = dt2;
                            }
                            else if (textBoxGYS.Text != "")
                                {
                                    DataTable dt3 = new DataTable();
                                    string sql_3 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where drugsId like '%" + textBoxYPID.Text + "%' and providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                    dt3 = op.getDataTable(sql_3, "drugsStore ");
                                    dataGridView1.DataSource = dt3;
                                }
                                else 
                                {
                                    DataTable dt4 = new DataTable();
                                    string sql_4 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where drugsId like '%" + textBoxYPID.Text + "%' order by Id";
                                    dt4 = op.getDataTable(sql_4, "drugsStore ");
                                    dataGridView1.DataSource = dt4;
                                }
                            
                            
                        }
                        else 
                        {
                            if (textBoxPYM.Text != "")
                            {
                                if (textBoxGYS.Text != "")
                                {
                                    DataTable dt1 = new DataTable();
                                    string sql_1 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where   drugsPY like '%" + textBoxPYM.Text + "%' and providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                    dt1 = op.getDataTable(sql_1, "drugsStore ");
                                    dataGridView1.DataSource = dt1;
                                }
                                else
                                {
                                    DataTable dt2 = new DataTable();
                                    string sql_2 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where  drugsPY like '%" + textBoxPYM.Text + "%' order by Id";
                                    dt2 = op.getDataTable(sql_2, "drugsStore ");
                                    dataGridView1.DataSource = dt2;
                                }
                            }
                            else if (textBoxGYS.Text != "")
                                {
                                    DataTable dt3 = new DataTable();
                                    string sql_3 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore  where  providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                    dt3 = op.getDataTable(sql_3, "drugsStore ");
                                    dataGridView1.DataSource = dt3;
                                }
                                else
                                {
                                    DataTable dt4 = new DataTable();
                                    string sql_4 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore   order by Id";
                                    dt4 = op.getDataTable(sql_4, "drugsStore ");
                                    dataGridView1.DataSource = dt4;
                                }
                        }
                      

                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); return; }
                }
                if (radioButton1.Checked == true)
                {    
                    if (textBoxYPID.Text != "")
                    {
                         if (textBoxPYM.Text != "")
                         {
                              if (textBoxGYS.Text != "")
                              {
                                   DataTable dt1 = new DataTable();
                                   string sql_1 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and  a.drugsId like '%" + textBoxYPID.Text + "%' and  a.drugsPY like '%" + textBoxPYM.Text + "%' and a.providerCompany like '%" + textBoxGYS.Text + "%' order by a.Id";
                                   dt1 = op.getDataTable(sql_1, "drugsStore ");
                                   dataGridView1.DataSource = dt1;
                              }
                                   DataTable dt2 = new DataTable();
                                   string sql_2 = " b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and a.drugsId like '%" + textBoxYPID.Text + "%' and  a.drugsPY like '%" + textBoxPYM.Text + "%' order by a.Id";
                                   dt2 = op.getDataTable(sql_2, "drugsStore ");
                                   dataGridView1.DataSource = dt2;
                         }
                          else if (textBoxGYS.Text != "")
                               {
                                    DataTable dt3 = new DataTable();
                                    string sql_3 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and a.drugsId like '%" + textBoxYPID.Text + "%' and a.providerCompany like '%" + textBoxGYS.Text + "%' order by a.Id";
                                    dt3 = op.getDataTable(sql_3, "drugsStore ");
                                    dataGridView1.DataSource = dt3;
                               }
                               else
                               {
                                    DataTable dt4 = new DataTable();
                                    string sql_4 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and a.drugsId like '%" + textBoxYPID.Text + "%' order by a.Id";
                                    dt4 = op.getDataTable(sql_4, "drugsStore ");
                                    dataGridView1.DataSource = dt4;
                               }


                    }
                    else
                    {
                         if (textBoxPYM.Text != "")
                         {
                               if (textBoxGYS.Text != "")
                               {
                                    DataTable dt1 = new DataTable();
                                    string sql_1 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and   a.drugsPY like '%" + textBoxPYM.Text + "%' and a.providerCompany like '%" + textBoxGYS.Text + "%' order by a.Id";
                                    dt1 = op.getDataTable(sql_1, "drugsStore ");
                                    dataGridView1.DataSource = dt1;
                               }
                               else
                               {
                                    DataTable dt2 = new DataTable();
                                    string sql_2 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and  a.drugsPY like '%" + textBoxPYM.Text + "%' order by a.Id";
                                    dt2 = op.getDataTable(sql_2, "drugsStore ");
                                    dataGridView1.DataSource = dt2;
                               }
                        }
                         else if (textBoxGYS.Text != "")
                              {
                                    DataTable dt3 = new DataTable();
                                    string sql_3 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin  and  a.providerCompany like '%" + textBoxGYS.Text + "%' order by a.Id";
                                    dt3 = op.getDataTable(sql_3, "drugsStore ");
                                    dataGridView1.DataSource = dt3;
                              }
                             else
                             {
                                    DataTable dt4 = new DataTable();
                                    string sql_4 = "select b.drugsMin 库存下限值, a.drugsCount 库存数量,a.drugsStorePlace 库存地址,a.drugsId 药品ID,a.drugsName 药品名称, a.drugsPY 拼音码, a.drugsSpecification 药品规格,a.drugsUnit 计量单位,a.drugsRegNum 批准文号 ,a.drugsFactory 生产厂家,a.providerCompany 供应商,a.drugsUsefulDate 有效期,a.drugsInPrice 进货价格,a.drugsSalePrice 销售价格 from drugsstore a left outer join  drugswarning b on a.drugsid=b.drugsid where a.drugsCount<b.drugsMin   order by a.Id";
                                    dt4 = op.getDataTable(sql_4, "drugsStore ");
                                    dataGridView1.DataSource = dt4;
                             }
                    }
                }
                if (radioButton3.Checked == true)
                {
                    try
                    {
                        if (textBoxYPID.Text != "")
                        {
                            if (textBoxPYM.Text != "")
                            {
                                if (textBoxGYS.Text != "")
                                {
                                    DataTable dt1 = new DataTable();
                                    string sql_1 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and drugsId like '%" + textBoxYPID.Text + "%' and  drugsPY like '%" + textBoxPYM.Text + "%' and providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                    dt1 = op.getDataTable(sql_1, "drugsStore ");
                                    dataGridView1.DataSource = dt1;
                                }
                                DataTable dt2 = new DataTable();
                                string sql_2 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and drugsId like '%" + textBoxYPID.Text + "%' and  drugsPY like '%" + textBoxPYM.Text + "%' order by Id";
                                dt2 = op.getDataTable(sql_2, "drugsStore ");
                                dataGridView1.DataSource = dt2;
                            }
                            else if (textBoxGYS.Text != "")
                            {
                                DataTable dt3 = new DataTable();
                                string sql_3 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and drugsId like '%" + textBoxYPID.Text + "%' and providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                dt3 = op.getDataTable(sql_3, "drugsStore ");
                                dataGridView1.DataSource = dt3;
                            }
                            else
                            {
                                DataTable dt4 = new DataTable();
                                string sql_4 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and drugsId like '%" + textBoxYPID.Text + "%' order by Id";
                                dt4 = op.getDataTable(sql_4, "drugsStore ");
                                dataGridView1.DataSource = dt4;
                            }


                        }
                        else
                        {
                            if (textBoxPYM.Text != "")
                            {
                                if (textBoxGYS.Text != "")
                                {
                                    DataTable dt1 = new DataTable();
                                    string sql_1 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and  drugsPY like '%" + textBoxPYM.Text + "%' and providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                    dt1 = op.getDataTable(sql_1, "drugsStore ");
                                    dataGridView1.DataSource = dt1;
                                }
                                else
                                {
                                    DataTable dt2 = new DataTable();
                                    string sql_2 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and drugsPY like '%" + textBoxPYM.Text + "%' order by Id";
                                    dt2 = op.getDataTable(sql_2, "drugsStore ");
                                    dataGridView1.DataSource = dt2;
                                }
                            }
                            else if (textBoxGYS.Text != "")
                            {
                                DataTable dt3 = new DataTable();
                                string sql_3 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate()) and  providerCompany like '%" + textBoxGYS.Text + "%' order by Id";
                                dt3 = op.getDataTable(sql_3, "drugsStore ");
                                dataGridView1.DataSource = dt3;
                            }
                            else
                            {
                                DataTable dt4 = new DataTable();
                                string sql_4 = "select drugsUsefulDate 有效期, drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsstore where drugsUsefulDate<(select getdate())  order by Id";
                                dt4 = op.getDataTable(sql_4, "drugsStore ");
                                dataGridView1.DataSource = dt4;
                            }
                        }


                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); return; }
                }
           }
           catch (Exception ex) { MessageBox.Show(ex.Message); return; }    
        } 
                

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            FrmStoreManageDetail fsmd = new FrmStoreManageDetail();
            fsmd.Show();

        }

        private void FrmDrugsStoreManage_Load(object sender, EventArgs e)
        {
            radioButton2.Checked = true;
            DataTable dt5 = new DataTable();
            string sql_5 = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore   order by Id";
            dt5 = op.getDataTable(sql_5, "drugsStore ");
            dataGridView1.DataSource = dt5;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            label5.Visible = true;
            dataGridView1.ReadOnly = false;
            
        }

        private void button6_Click(object sender, EventArgs e)
        {
            try
            {
                string a1 = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                string a2 = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
                string a3 = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
                string a4 = dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
                string a5 = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
                string a6 = dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
                string a7 = dataGridView1.SelectedRows[0].Cells[6].Value.ToString();
                string a8 = dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
                string a9 = dataGridView1.SelectedRows[0].Cells[8].Value.ToString();
                string a10 = dataGridView1.SelectedRows[0].Cells[9].Value.ToString();
                string a11 = dataGridView1.SelectedRows[0].Cells[10].Value.ToString();
                string a12 = dataGridView1.SelectedRows[0].Cells[11].Value.ToString();
                string a13 = dataGridView1.SelectedRows[0].Cells[12].Value.ToString();
                DataTable dt3 = new DataTable();
                string sql_3 = " UPDATE drugsStore SET  drugsName ='" + a2 + "', drugsPY ='" + a3 + "', drugsSpecification ='" + a4 + "', drugsUnit ='" + a5 + "', drugsCount ='" + a6 + "', drugsStorePlace ='" + a7 + "', drugsRegNum ='" + a8 + "', drugsFactory ='" + a9 + "', providerCompany ='" + a10 + "', drugsUsefulDate ='" + a11 + "', drugsInPrice ='" + a12 + "', drugsSalePrice ='" + a13 + "' where drugsId='" + a1 + "'";
                dt3 = op.getDataTable(sql_3, "drugsStore");



                dataGridView1.ReadOnly = true;

                radioButton2.Checked = true;
                DataTable dt = new DataTable();
                string sql = "select drugsId 药品ID,drugsName 药品名称, drugsPY 拼音码, drugsSpecification 药品规格,drugsUnit 计量单位, drugsCount 库存数量,drugsStorePlace 库存地址,drugsRegNum 批准文号 ,drugsFactory 生产厂家,providerCompany 供应商,drugsUsefulDate 有效期,drugsInPrice 进货价格,drugsSalePrice 销售价格 from drugsStore   order by Id";
                dt = op.getDataTable(sql, "drugsStore ");
                dataGridView1.DataSource = dt;

                MessageBox.Show("保存成功！库存信息已被修改！");
                label5.Visible = false;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); return; }
        }

     

      
    }
}